﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HomeWork2_2
{
    class Program
    {
        static void proArray(int[] array, out int Max, out int Min, out double Ave, out int Sum)
        {
            int Max0 = int.MinValue;
            int Min0 = int.MaxValue;
            int Sum0 = 0;
            foreach (int i in array)
            {
                if (i > Max0)
                    Max0 = i;
                if (i < Min0)
                    Min0 = i;
                Sum0 += i;
            }
            Max = Max0;
            Min = Min0;
            Sum = Sum0;
            Ave = Sum / Convert.ToDouble(array.Length);
            Console.WriteLine($"数组的最大值是{Max}");
            Console.WriteLine($"数组的最小值是{Min}");
            Console.WriteLine($"数组的总和{Sum}");
            Console.WriteLine($"数组的平均值是{Ave}");
        }
        static void Main(string[] args)
        {
            int[] test = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            proArray(test, out int Max, out int Min, out double Ave, out int Sum);
        }
    }
}
